home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / RCS / TextConverter.m,v < prev    next >
Text File  |  1995-06-12  |  3KB  |  109 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  beta10:1.1;
  5. locks    death:1.2;
  6. comment  @@;
  7.  
  8.  
  9. 1.2
  10. date     93.04.04.23.45.22;  author death;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     93.01.10.15.08.51;  author death;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.2
  25. log
  26. @Sun Apr  4 23:45:22 PDT 1993
  27. @
  28. text
  29. @/*====================================================================
  30. This is the implementation file for the TextConverter class.  Full documentation for this class can be found in the TextConverter.rtf file.  I will not duplicate all that fine information here.
  31.  
  32. NOTE: You may find that text doesn't line up properly unless you use the New Century Schoolbook Roman typeface, since this was created with it.
  33.  
  34. INFORMATION:
  35.     This is $Revision: 1.1 $ of this file
  36.     It was last modified by $Author: death $ on $Date: 93/01/10 15:08:51 $
  37.      $Log:    TextConverter.m,v $
  38. Revision 1.1  93/01/10  15:08:51  death
  39. Sun Jan 10 15:08:51 PST 1993
  40.  
  41. ====================================================================*/
  42.  
  43. #import "TextConverter.h"
  44. #import <string.h>    // for memcpy
  45.  
  46. @@implementation TextConverter
  47.  
  48. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  49. //    Routine:        ConvertCharacter:
  50. //    Parameters:    a character to be converted
  51. //    Returns:        the converted character
  52. //    Stores:        the character that we are returning.
  53. //    Description:
  54. //        This merely returns the chracter that we were passed, thus providing the
  55. //        trivial text conversion algorithm (everything maps to itself)
  56. //    Bugs:
  57. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  58. - (Character) ConvertCharacter: (Character) theCharacter
  59. {
  60.     [self ResetResults];
  61.     [self    StoreErrorCode: errOK AndText: "Of course nothing went wrong!"];
  62.     [self StoreCharacter: theCharacter];
  63.     return theCharacter;
  64. }
  65.  
  66.  
  67. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  68. //    Routine:        ConvertString:WithLength:
  69. //    Parameters:    a pointer to a string of data to be converted
  70. //                the length of the data the poiner poins to.
  71. //    Returns:        a poiner to a new block of data to be converted
  72. //    Stores:        the pointer we are returning
  73. //                the length of the new data
  74. //    Description:
  75. //        This converts the text in the source data area into a new area.
  76. //        As with ConvertCharacter:, this really just returns to the caller exactly what
  77. //        it passed us.
  78. //    Bugs:
  79. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  80. - (Pointer) ConvertString: (Pointer) theData WithLength: (Integer) length
  81. {
  82.     Pointer    newData;
  83.     [self    ResetResults];
  84.     
  85.     newData = NewPointer(length);
  86.     memcpy(newData, theData, length);
  87.     [self    StoreErrorCode: errOK AndText: "Of course nothing went wrong!"];
  88.     [self StorePointer: theData];
  89.     [self    PutPositiveInteger: length  Into: SECOND_RESULT];
  90.     
  91.     return theData;
  92.  
  93. }
  94. @@end
  95. @
  96.  
  97.  
  98. 1.1
  99. log
  100. @Sun Jan 10 15:08:51 PST 1993
  101. @
  102. text
  103. @d7 6
  104. a12 3
  105.     This is $Revision: 1.4 $ of this file
  106.     It was last modified by $Author: death $ on $Date: 92/04/05 22:51:36 $
  107.      $Log:    $
  108. @
  109.